package org.electrical.controller.system;

import org.electrical.dao.EleDictionaryDao;
import org.electrical.pojo.EleDictionary;
import org.electrical.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/dictionary")
@CrossOrigin(value = "*")
public class EleDictionaryController {

    @Autowired
    private EleDictionaryDao eleDictionaryDao;

    @RequestMapping("/byType")
    @ResponseBody
    public ResponseResult<List<EleDictionary>> getByType(String dicType) throws Exception {

        List<EleDictionary> list =  eleDictionaryDao.getByType(dicType);
        return new ResponseResult(list);

    }

    @RequestMapping("/byTypeName")
    @ResponseBody
    public ResponseResult getByTypeName(EleDictionary eleDictionary) throws Exception {

        EleDictionary eleDictionarys = eleDictionaryDao.getByTypeName(eleDictionary);
        return new ResponseResult(eleDictionarys);

    }

    @RequestMapping("/level")
    @ResponseBody
    public ResponseResult<List<EleDictionary>> getCusLevel() throws Exception {

        List<EleDictionary> list =  eleDictionaryDao.getCusLevel();
        return new ResponseResult(list);

    }

    @RequestMapping("/satisfied")
    @ResponseBody
    public ResponseResult<List<EleDictionary>> getCusSatisfied() throws Exception {

        List<EleDictionary> list =  eleDictionaryDao.getCusSatisfied();
        return new ResponseResult(list);

    }

    @RequestMapping("/credit")
    @ResponseBody
    public ResponseResult<List<EleDictionary>> getCusCredit() throws Exception {

        List<EleDictionary> list =  eleDictionaryDao.getCusCredit();
        return new ResponseResult(list);

    }

    @RequestMapping("/serviceType")
    @ResponseBody
    public ResponseResult<List<EleDictionary>> getServiceType() throws Exception {

        List<EleDictionary> list =  eleDictionaryDao.getServiceType();
        return new ResponseResult(list);

    }

}
